<template>
  <div id="app">


	<keep-alive>
		<router-view class="view" v-if="$route.meta.keep_alive"></router-view>
	</keep-alive>
	<router-view class="view" v-if="!$route.meta.keep_alive"></router-view>


 
	<!-- <router-view/> -->
  </div>
</template>

<script>
import router from './router'
import url from 'url'
import axios from "axios"
import sha1 from "sha1"
import wx from 'weixin-jsapi'
const _this = wx;
export default {
	name: 'App',
  // created(){
  //   localStorage.setItem("openid",'o1KIj0ydbQPihENeImso6zKWWrtI');
  // },
	components: {
		// Footer
	},
	methods:{
		// 获取openid
		getOpenid:function(){
			return localStorage.getItem('openid');
		},
		//授权
		auth: function() {
			var uo = url.parse(window.location.href, true)
			//console.log(uo.hash)

			if( uo.query.merchant_id == undefined ){
				var redirect_uri = encodeURIComponent('http://www.huiwanzhong365.com/?merchant_id='+ uo.query.merchant_id +'&activity_id='+ uo.query.activity_id +'');
				window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxf81cf0b3b7c6bea1&redirect_uri='+ redirect_uri +'&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect';
			}else if(uo.hash == '#/Join'){
				var redirect_uri = encodeURIComponent('http://www.huiwanzhong365.com/?merchant_id='+ uo.query.merchant_id +'&activity_id='+ uo.query.activity_id +'#Join');
				window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxf81cf0b3b7c6bea1&redirect_uri='+ redirect_uri +'&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect';
			}else{
				var redirect_uri = encodeURIComponent('http://www.huiwanzhong365.com/?merchant_id='+ uo.query.merchant_id +'&activity_id='+ uo.query.activity_id +'#RedPacket');
				window.location.href = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxf81cf0b3b7c6bea1&redirect_uri='+ redirect_uri +'&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect';
			}
		},
		//获取code
		getCode:function(){
			// var url = window.location.href
			var uo = url.parse(window.location.href, true)

			if(uo.query.code == null) {
				this.auth();
				//this.wxInit();
			}

            var that = this
            axios.get("http://api.huiwanzhong365.com/index/login", {
              headers: {
                "Content-Type": "application/x-www-form-urlencoded"
              },
              params: {
				code: uo.query.code
              }
            })
            .then(function(res) {
              //console.log(res.data.openid +'111111111111111111');
			    var openid = res.data.openid

				if(openid == null) {
					this.auth();
				}
				localStorage.setItem("openid",openid)
				//console.log(localStorage.getItem("openid"))
				//console.log(uo)
            })
            .catch(function(error) {
              //console.log(error);
            });
		},
	},
	mounted(){

		var that = this
		axios.get('/vueSdk',{
			headers: {
				"Content-Type": "application/x-www-form-urlencoded"
			},
			params: {
				url: encodeURIComponent(location.href.split('#')[0]),
			}
		})
		.then(function(res) {
			//console.log(res.data.nonceStr)
			// var res = response.data
			//that.wxInit(res)
			wx.config({
				debug: false,
				appId: res.data.appId,
				timestamp: res.data.timestamp,
				nonceStr: res.data.nonceStr,
				signature: res.data.signature,
				jsApiList: [
					'onMenuShareTimeline',
					'onMenuShareAppMessage',
					'chooseWXPay'
				]
			});

		})
		if(!this.getOpenid()) {
			this.getCode();
		}
		//this.auth();

		//this.code();
	},
}

</script>


<style>
html{
	width: 100%;
	height: 100%;
}
*{
  margin:0;
  padding:0;
  -webkit-touch-callout:none;  /*系统默认菜单被禁用*/
  -webkit-user-select:none; /*webkit浏览器*/
  -khtml-user-select:none; /*早期浏览器*/
  -moz-user-select:none; /*火狐*/
  -ms-user-select:none;  /*IE10*/
  user-select:none;

}
body{
	background: #f9f9f9;
	/* background: #FE2746; */
	width:100%;
	height:100%;
}
#app {
  font-family: "微软雅黑","Microsoft YaHei";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #333;
  font-size:14px;
  width:100%;
  height:100%;
}
.slider-wrapper img{
	width:100%;
	height:100%;
}
em,i{
  font-style: normal;
}
a{
  text-decoration: none;
  color:#333;
}
.left{
  float:left;
}
.right{
  float:right;
}
img{
  vertical-align: bottom;
}
/*公共边框*/
.common-form{
	width:94%;
	margin:0 auto;
	background: #FFF;
	border-radius: 5px;
	margin-top:15px;
	overflow: hidden;
}
.footer-100{
  width:100%;
  height:50px;
}
/*公共边框*/
/* .common-form{
	width:94%;
	margin:0 auto;
	background: #FFF;
	border-radius: 5px;
	margin-top:10px;
	overflow: hidden;
} */
/*公共标题*/
.common-tel{
	width:94%;
	margin:0 auto;
	margin-top:15px;
	color:#FE2746;
	font-size:15px;
	font-weight: 600;
	display: inline-block;
	margin-left: 3%;
}
.common-tel-dot em:nth-child(1){
    width: 12px;
    height: 2px;
    background: #FE2746;
    float: left;
    margin-top: 5px;
}
.common-tel-dot em:nth-child(2){
    width: 8px;
    height: 2px;
	background-color: rgba(254, 39, 70, 0.59);
	float: left;
    margin-top: 5px;
    margin-left: 6px;
}
.common-tel-dot em:nth-child(3){
    width: 6px;
    height: 2px;
	background-color: rgba(254, 39, 70, 0.3);
	float: left;
    margin-top: 5px;
    margin-left: 6px;
}
.common-tel a{
 	color: #FE2746;
    float: right;
    font-size: 12px;
    font-weight: 100;
    margin-top: -13px;
}
.common-tel a i{
	color:#FE2746;
}
ul li{
  list-style: none;
}
/* 详情 */

.detail-tel,.detail-price,.detail-other{
	width:94%;
	margin:5px auto;
	line-height: 24px;
}
.detail-tel span{
    font-size: 12px;
    color: #999;
    float: right;
    margin-top: -17px;
}
.detail-tel span i{
	display: inline-block;
    height: 19px;
    width: 20px;
    overflow: hidden;
    margin-top: 2px;
    background: url(./assets/xin.png) no-repeat;
    background-size: 100%;
    margin-top: 5px;
    vertical-align: text-bottom;
}
.detail-price p:nth-child(1){
	font-size:12px;
	color:#999;
}
.detail-price p:nth-child(2){
    color: #FE2746;
    font-weight: 600;
    font-size: 14px;
}
.detail-price p:nth-child(2) em{
	color:#FE2746;
	font-size:18px;
}
.detail-other{
	display: inline-block;
	margin-left: 3%;
	margin-bottom: 2%;
}
.detail-other em{
	width:33.33%;
	float:left;
	color:#999;
	font-size:12px;
}
.detail-other em:nth-child(1){
	text-align: left;
}
.detail-other em:nth-child(2){
	text-align: center;
}
.detail-other em:nth-child(3){
	text-align: right;
}
.detail-recharge em{
	background: #FE2746;
	color:#FFF;
	font-weight: 600;
	text-align: center;
	line-height: 36px;
	padding:9px 8px;
	border-bottom-left-radius: 5px;
	border-top-left-radius: 5px;
}
.detail-recharge i{
	color:#FE2746;
	float: right;
	padding:8px;
	font-size:14px;
}
.detail-service{
	padding:9px 8px;
	font-size:12px;
	color:#999;
}
.detail-service span{
	color:#FE2746;
	font-weight: 600;
}
.detail-service span em{
	width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #FE2746;
    display: inline-block;
    margin: 2px 6px;
}
.detail-evaluate-img{
	width:12%;
	float:left;
	text-align: center;
}
.detail-evaluate img{
	width:20px;
	height:20px;
	border-radius: 50%;
}
.detail-evaluate,.detail-shop{
    width: 94%;
    margin: 0 auto;
    display: inline-block;
    margin-left: 3%;
    padding-top: 3%;
}
.detail-evaluate-img{
	width:12%;
	float:left;
	text-align: center;
}
.detail-evaluate-text{
    width: 88%;
    float: left;
    padding-bottom: 3%;
    /* border-bottom: 1px solid #f2f2f2; */
}
.detail-evaluate-text p:nth-child(1){
	color:#999;
	font-size:15px;
}
.detail-evaluate-text p:nth-child(2){
	font-size:12px;
	margin-top:8px;
}
.detail-shop-img{
	width:20%;
	float: left;
}
.detail-shop-text-other{
	margin-top:10px;
}
.detail-shop-text-other span{
	color:#999;
	font-size:12px;
}
.detail-shop-text-other span:nth-child(2){
	margin:0 2%;
}
.detail-shop-text-other span em{
	color:#FE2746;
	font-size:12px;
}
.detail-shop img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-top: 7px;
}
.detail-shop-text-tel a {
    text-align: center;
    font-size: 12px;
    background: #FE2746;
    color: #FFF;
    border-radius: 20px;
    padding: 3px 9px;
    float: right;
}
.detail-info img {
    width: 100%;
}
/* 选择规格 */
/* .black{
	position: fixed;
	top:0;
	left:0;
	width:100%;
	height:100%;
	background: rgba(0, 0, 0, 0.5);
	z-index: 9;
	display: none;
} */
.footer-standard{
	position: fixed;
	bottom:0;
	left:0;
	width:100%;
	background: #FFF;
	border-top-right-radius: 5px;
	border-top-left-radius: 5px;
	z-index: 10;
	overflow: hidden;
	/* display: none; */
}
.footer-standard-shop{
	width:94%;
	margin:3% auto;
}
.footer-standard-shop img{
	width:92px;
	height:92px;
	border-radius: 5px;
	float: left;
}
.footer-standard-shop div{
	margin-left: 10px;
	display: inline-block;
	margin-top:15px;
}
.footer-standard-shop div p:nth-child(1){
	color:#FE2746;
	font-size:16px;
}
.footer-standard-shop div p:nth-child(1) em{
	color:#FE2746;
	font-size:18px;
}
.footer-standard-shop div p:nth-child(2) em{
	color:#999;
}
.footer-standard-shop div p:nth-child(2){
	font-size:12px;
}
.detail-btn{
	width:100%;
	color:#FFF;
	background:#FE2746;
	height:49px;
	text-align: center;
	border:0;
	margin-top: 40px
}
.footer-standard-num{
	margin-top:15px;
	width:94%;
	margin-left: 3%;
	display: inline-block;
}
.footer-standard-num p{
	font-size:16px;
}
.footer-standard-num div em{
    padding:5px 14px;
    border-radius: 20px;
    background-color: rgba(123, 123, 123, 0.08);
    text-align: center;
    margin-top: 15px;
    display: inline-block;
    margin-left: 6px;
}
.active{
	/* background-color: rgba(254, 39, 70, 0.08) !important; */
	color:#FE2746;
}
/*商品数量*/
.goods-num{
    margin-top: 15px;
    display: inline-block;
}
.add,.sub{
	font-size:20px;
	float: left;
	width:25px;
	height:25px;
	line-height: 25px;
	text-align: center;
}
.num{
	float: left;
}
.num input{
	width: 45px;
	height: 25px;
	line-height: 25px;
	border-radius: 20px;
	background-color: rgba(254, 39, 70, 0.08);
	border:0;
	text-align: center;
	color:#FC2847;
}
.detail-footer{
    position: fixed;
    bottom:0;
    left:0;
    width:100%;
    height:56px;
    background: #EBEBEB;
}
.detail-footer a:nth-child(1){
	width:20%;
	float: left;
	text-align: center;
}
.detail-footer a:nth-child(1) i{
	display: inline-block;
    height: 21px;
    width: 22px;
    overflow: hidden;
    margin-top: 2px;
    background: url(./assets/index.png)  no-repeat;
    background-size:100%;
    margin-top:5px;
}
.detail-footer a:nth-child(2) i{
	display: inline-block;
    height: 21px;
    width: 22px;
    overflow: hidden;
    margin-top: 2px;
    background: url(./assets/kefu.png)  no-repeat;
    background-size:100%;
    margin-top:5px;
}
.detail-footer a:nth-child(2){
	width:20%;
	float: left;
	text-align: center;
}
.detail-footer a:nth-child(3) i{
	display: inline-block;
    height: 21px;
    width: 22px;
    overflow: hidden;
    margin-top: 2px;
    background: url(./assets/shop.png)  no-repeat;
    background-size:100%;
    margin-top:5px;
}
.detail-footer a:nth-child(3){
	width:60%;
	float: left;
	background: #FE2746 ;
	color:#FFF;
	text-align: center;
	height: 48px;
	line-height: 48px;
	height:48px;
	color:#FFF;
}
.detail-shop {
    padding-bottom: 3%;
}
/* 商品样式 */
.shop{
	width:100%;
	display: inline-block;
	/* margin-left:3%; */
}
.shop-goods{
    width: 46.5%;
    float: left;
    background: #FFF;
    border-radius: 5px;
    overflow: hidden;
    margin-top: 10px;
    padding-bottom: 10px;
    margin: 2% 1.7% 2% 1.8%;
}
.shop-goods img{
	width:100%;
	height:173px;
}
.shop-goods-info p:nth-child(1){
	width: 88%;
	margin: 0 auto;
	font-size: 13px;
	padding: 2px 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	margin-top: 4px;
}
.shop-goods-info p:nth-child(2){
	width: 88%;
	margin: 0 auto;
	font-size:12px;
	color:#999;
}
.shop-goods-info p:nth-child(3){
	font-size:12px;
	color:#999;
	width: 88%;
	margin: 0 auto;
}
.shop-goods-info p:nth-child(3) em{
	color:#FC2847;
}
.shop-goods-info p:nth-child(3) em i{
	color:#FC2847;
	font-size:14px;
}
/*.shop-goods-info p:nth-child(3) em{
	color:#999;
	font-size:12px;
	float: right;
}*/
/* .shop .shop-goods:nth-child(odd){
    margin-right: 3%;
} */
.shop-goods-info p:nth-child(1) {
    width: 88%;
	height:24px;
    margin: 0 auto;
    font-size: 13px;
    padding: 2px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 4px;
}
/*会员列表*/
.vip-list-ranking ,.vip-list-sales,.vip-list-price{
	width:33.33%;
	float: left;
	text-align: center;
	padding:10px 0;
}
.vip-list-ranking a,.vip-list-sales a,.vip-list-price a{
	position: relative;
    font-size:13px;
}
.vip-list-ranking em:nth-child(1),.vip-list-sales em:nth-child(1),.vip-list-price em:nth-child(1){
    width: 0;
    height: 0;
    border-right: 5px solid transparent;
    border-left: 5px solid transparent;
    border-bottom: 5px solid #999;
    position: absolute;
    top: 17%;
    right: -45%;
}
.vip-list-ranking em:nth-child(2),.vip-list-sales em:nth-child(2),.vip-list-price em:nth-child(2){
    width: 0;
    height: 0;
    border-right: 5px solid transparent;
    border-left: 5px solid transparent;
    border-top: 5px solid #999;
    position: absolute;
    top: 58%;
    right: -45%;
}




/*确认订单*/
.order-info{
    padding: 10px 8px;
    position: relative;
    display: inline-block;
	width: 97%;
}
.order-info-none{
	width:100%;
	height:90px;
	display: inline-block;
	color:#999;
	text-align: center;
	line-height: 90px;
}
.order-info-none em{
	font-size:20px;
	color:#999;
	vertical-align: bottom;
}
.order-info-a{
	position: absolute;
    right: 10px;
    top: 39%;
    display: block;
    height: 19px;
    width: 20px;
    overflow: hidden;
    background: url(./assets/jiantou.png) no-repeat;
    background-size: 100%;
    margin-top: 0px;
    float: right;
}
.order-info-name{
	font-size:15px;
	font-weight: 600;
	margin-bottom: 10px;
}
.order-info-add label{
	float: left;
	width:14%;
	display: inline-block;
}
.order-info-add span{
	float: left;
	width:80%;
	display: inline-block;
    font-weight: 600;
}

.order-shop,.order-pay{
    width: 94%;
    margin: 3% auto;
    display: inline-block;
    margin-left: 3%;
}
.order-shop-tel{
	border-bottom: 1px solid #f2f2f2;
	padding-bottom: 10px;
	font-weight: 600;
}
.order-shop-tel i{
    display: block;
    height: 19px;
    width: 20px;
    overflow: hidden;
    background: url(./assets/cart.png) no-repeat;
    background-size: 100%;
    margin-top: 0px;
    float: left;
    margin-right: 5px;
}
.order-shop-more{
    width: 100%;
    height: 38px;
    line-height: 38px;
    display: inline-block;
}
.order-shop div:nth-child(5) em,.order-shop div:nth-child(4) em,.order-shop div:nth-child(3) em,.order-shop div:nth-child(6) input{
	 float: right;
}

.order-shop div:nth-child(6) input{
	width:100px;
	text-align: right;
	border:0;
	outline: none;
    padding: 10px 0;
}
.order-shop img{
	width:80px;
	height:80px;
	border-radius: 5px;
	float: left;
}
.order-shop-info{
    display: inline-block;
    width: 100%;
    margin-bottom: 10px;
    margin-top:10px;
}
.order-shop-info div{
    float: left;
    margin-left: 2%;
    width: 71%;
}
.order-shop-info div p:nth-child(1){
	width:100%;
	overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.order-shop-info div p:nth-child(2){
	color:#999;
	margin:10px 0;
	font-size:12px;
}
.order-shop-info div p:nth-child(3){
	color:#FE2746;
	font-weight: 600;
}
.order-shop-info div p:nth-child(3) del{
	color:#999;
	font-size:12px;
	font-weight: normal;
}
.order-pay{
	position: relative;
}
.order-pay img{
	width:40px;
	height:40px;
	float: left;
	border-radius: 50%;
}
.order-pay div{
    width: 60%;
    float: left;
    margin-left: 3%;
}
.order-pay div p:nth-child(2){
    color: #999;
    font-size: 12px;
    margin-top: 5px;
}
.order-pay em{
	width: 10px;
	height: 10px;
	display: inline-block;
	border: 1px solid rgba(187, 187, 187, 1);
	border-radius: 50%;
	position: absolute;
	top:36%;
	right: 10px;
}
.order-pay-pink{
	border: 1px solid #FE2746 !important;
	background: #FE2746;
}
.order-footer{
	position: fixed;
	bottom: 0;
	left:0;
	height:49px;
	line-height: 49px;
	width:100%;
	background: #FFF;
}
.order-footer div{
	width:67%;
	float: left;
	margin-left: 3%;
	background: #FFF;
}
.order-footer div span{
	color:#FE2746;
}
.order-footer div span em{
	font-size:15px;
	font-weight: 600;
	color:#FE2746;
}
.order-footer a{
	width:30%;
	float: left;
	background: #FE2746 ;
	text-align: center;
	color:#FFF;
}

/*选择地址*/
.order-select-info{
	width:94%;
	margin:3%;
	display: inline-block;
	position: relative;
}
.order-select{
	width: 10px;
    height: 10px;
    /*background-color: rgba(252, 40, 71, 1);*/
    border: 1px solid rgba(187, 187, 187, 1);
    border-radius: 50%;
    display: inline-block;
    float: left;
    position: absolute;
    top: 41%;
    left: -2px;
}
.order-select-info-name{
	font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
}
.order-select-pink{
	background-color: rgba(252, 40, 71, 1);
	border: 1px solid rgba(252, 40, 71, 1)!important;
}
.order-select-info-name,.order-select-info-add,.order-add-info-add{
	margin-left: 22px;
	width: 88%;
}
.order-select-info-edit{
	position: absolute;
    right: 0px;
    top: 37%;
    display: block;
    height: 19px;
    width: 20px;
    overflow: hidden;
    background: url(./assets/edit.png) no-repeat;
    background-size: 100%;
    margin-top: 0px;
    float: right;
}



/*添加地址*/
.order-add-info-add span{
	color:#999;
}
.order-user{
	width:94%;
	margin:3%;
	display: inline-block;
}
.order-add-user{
	height:38px;
}
.order-add-user-textarea{
    margin-top:10px;
}
.order-add-user label{
	width:70px;
	line-height: 38px;
	float: left;
	display: inline-block;
}
.order-add-user-textarea label{
    width: 70px;
    display: inherit;
    float: left;
}
.order-add-user-textarea textarea{
	padding: 0px 9px;
    width: 71%;
    border: 0;
    height: 38px;
    font-weight: 600;
}
.order-add-user input{
	padding: 9px;
    width: 71%;
    border:0;
    font-weight: 600;
}
.order-add-user span{
	width: 75%;
    display: inline-block;
    float: left;
    margin-top:9px;
}

</style>
